﻿CREATE TABLE [dbo].[sys_MessageUserMapping]
(
    [UserID] INT NOT NULL, 
    [MessageID] INT NOT NULL, 
    [IsRead] BIT NOT NULL DEFAULT 0, 
    [ReadDt] DATETIME NULL, 
    CONSTRAINT [PK_sys_MessageUserMapping] PRIMARY KEY ([UserID],[MessageID]), 
    CONSTRAINT [FK_sys_MessageUserMapping_User] FOREIGN KEY ([UserID]) REFERENCES [sys_LoginUsers]([UserID]), 
    CONSTRAINT [FK_sys_MessageUserMapping_Message] FOREIGN KEY ([MessageID]) REFERENCES [sys_UserMessage]([MessageID])
)
